#include <iostream>
#include <cstdlib>
#pragma comment (lib, "glut32.lib") 
#include <GL\glut.h>





void RenderScene(void){
	
	glClear(GL_COLOR_BUFFER_BIT);

	glColor3f(1.0f,0.0f,0.0f);
	glRectf(-25.0f,25.0f,25.0f,-25.0f);

	glFlush();

}

void RenderBackgroundScene(void){
	glClear(GL_COLOR_BUFFER_BIT);

	
	//glClearColor(1.0f,1.0f,1.0f,1.0f);
	glColor3f(1.0f,0.0f,0.0f);
	glRectf(-25.0f,25.0f,25.0f,-25.0f);
	glFlush();
}



void SetupRC(void){
	glClearColor(0.0f,0.0f,1.0f,1.0f);
}


void changeSize(GLsizei w, GLsizei h){
	GLfloat aspectRatio;


	if(h==0)
		h=1;
	glViewport(0,0,w,h);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();


	aspectRatio =(GLsizei)w/(GLsizei)h;
	if(w<=h)
		glOrtho(-100.0f,100.0f,-100/aspectRatio , 100.0f/aspectRatio,1.0,-1.0);
	else
		glOrtho(-100.0f*aspectRatio,100.0f*aspectRatio,-100.0f , 100.0f,1.0,-1.0);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	

}


int main(int argc, char* argv[]){

	glutInit(&argc,argv);
	//glutInit(800,600);
	//glutInitWindowSize(800,600);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);

	glutCreateWindow("First OpenGL Program");
	glutInitWindowSize(800,600);
	glutInitWindowPosition(10,10);
	
	glutDisplayFunc(RenderScene);
	glutReshapeFunc(changeSize);
	SetupRC();	

	glutMainLoop();
	return 0;

}